CC = g++
AR = ar rcs
Ox = -O3
ARCH = -m64 -march=native
INC = -I..
SO = -shared -fPIC
FP = -fPIC
CP = cp -v
MK = mkdir -p
RM = rm -r
DIR = /usr/local
HEADS = Comm.h Domain.h Scalar.h Vector.h Matrix.h Others.h Set.h RK.h
IMPS = Comm.cpp Domain.cpp Scalar.cpp Vector.cpp Matrix.cpp Others.cpp Set.cpp RK.cpp
OBJS = Comm.o Domain.o Scalar.o Vector.o Matrix.o Others.o Set.o RK.o

Comm.o:	Comm.h Comm.cpp
		$(CC) -c Comm.cpp $(Ox) $(ARCH) $(FP) $(INC)

Domain.o:	Domain.h Domain.cpp
		$(CC) -c Domain.cpp $(Ox) $(ARCH) $(FP) $(INC)

Scalar.o:	Scalar.h Scalar.cpp
		$(CC) -c Scalar.cpp $(Ox) $(ARCH) $(FP) $(INC)

Vector.o:	Vector.h Vector.cpp
		$(CC) -c Vector.cpp $(Ox) $(ARCH) $(FP) $(INC)

Matrix.o:	Matrix.h Matrix.cpp
		$(CC) -c Matrix.cpp $(Ox) $(ARCH) $(FP) $(INC)

Others.o:	Others.h Others.cpp
		$(CC) -c Others.cpp $(Ox) $(ARCH) $(FP) $(INC)

Set.o:	Set.h Set.cpp
		$(CC) -c Set.cpp $(Ox) $(ARCH) $(FP) $(INC)
		
RK.o:	RK.h RK.cpp
		$(CC) -c RK.cpp $(Ox) $(ARCH) $(FP) $(INC)

libT3nsors.so:	$(OBJS)
	$(CC) $(IMPS) $(SO) -o libT3nsors.so

libT3nsors.a:	$(OBJS)
	$(AR) libT3nsors.a $(IMPS)

libT3nsors:	libT3nsors.so libT3nsors.a

install:
	$(MK) $(DIR)/include/T3nsors
	$(CP) $(HEADS) Macros.h T3nsors.h $(DIR)/include/T3nsors/
	$(CP) libT3nsors.* $(DIR)/lib/

clean:
	$(RM) *.o libT3nsors.*

uninstall:
	$(RM) $(DIR)/include/T3nsors
	$(RM) $(DIR)/lib/libT3nsors.*
